import URL from '@/config/url'
import utils from '@/utils/utils'

export default{
	// 获取施工队主页数据
	getIndexInfo(params={}){
		let data = {
			team_id:params.team_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildTeam/index',data})
	},
	
	// 获取施工队详情
	getUserInfo(params={}){
		let data = {
			team_id:params.team_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildTeam/getDetail',data})
	},
	
	// 编辑施工队信息
	editUserInfo(params={}){
		let data = {
			team_id:params.team_id,
			title:params.title,
			avatar:params.avatar,
			back_thumb_url:params.back_thumb_url,
			sign:params.sign
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildTeam/edit',data})
	},
	
	// 获取员工列表
	getStaffList(params={}){
		let data = {
			team_id:params.team_id,
			position:params.position
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/builder/getList',data})
	},
	
	// 新增员工
	addStaff(params={}){
		let id = params.id
		let data = {
			id,
			team_id:params.team_id,
			name:params.name,
			phone:params.phone,
			avatar:params.avatar
		}
		let oRurl = id?'/builder/builder/edit':'/builder/builder/add';
		return utils.uniRequest({url:URL.BASE2 + oRurl,data})
	},
	
	
	// 获取员工信息
	getStaffInfo(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/builder/getDetail',data})
	},
	
	// 删除员工
	delStaff(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/builder/del',data})
	},
	
	// 获取施工订单列表
	getStaffOrder(params={}){
		let data = {
			team_id:params.team_id,
			status:params.status,
			keyword:params.keyword,
			page:params.page,
			pagesize:params.pagesize
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/getList',data})
	},
	
	// 接单
	toAccept(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/accept',data})
	},
	
	// 获取订单详情
	getDetail(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/getDetail',data})
	},
	
	// 处理订单
	toHandleOrder(params={}){
		let data = {
			id:params.id,										//订单id
			director:params.director,							//负责人
			progress:params.progress,							//进度
			build_start_time:params.build_start_time,  			//施工开始时间
			build_end_time:params.build_end_time,  				//施工结束时间
			realname:params.realname,  							//户主
			phone:params.phone, 								//手机号
			estate:params.estate, 								//小区
			house_type:params.house_type,						//户型
			house_area:params.house_area,						//面积
			address:params.address,  							//地址
			province:params.province,							//省份
			city:params.city,									//城市
			district:params.district,							//县区
			street:params.street,								//街道
			remark:params.remark,								//户主诉求
			contract_price:params.contract_price, 				//合同金额
			draw_thumb_url:params.draw_thumb_url,  				//图纸
			contract_thumb_url:params.contract_thumb_url,		//合同
			material_thumb_url:params.material_thumb_url,		//选材单
			design_thumb_url:params.design_thumb_url,			//设计图纸
			province_id:params.province_id,
			city_id:params.city_id,
			district_id:params.district_id,
			street_id:params.street_id,
			is_back:params.is_back,
			pay_rule:params.pay_rule,
			order_no:params.order_no,
			pay_rule_desc:params.pay_rule_desc,
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/handle',data})
	},
	
	// 修改订单信息
	editOrder(params={}){
		let data = {
			id:params.id,										//订单id
			build_start_time:params.build_start_time,  			//施工开始时间
			build_end_time:params.build_end_time,  				//施工结束时间
			realname:params.realname,  							//户主
			phone:params.phone, 								//手机号
			estate:params.estate, 								//小区
			house_type:params.house_type,						//户型
			house_area:params.house_area,						//面积
			address:params.address,  							//地址
			city:params.city,									//城市
			district:params.district,							//县区
			street:params.street,								//街道
			remark:params.remark,								//户主诉求
			contract_price:params.contract_price, 				//合同金额
			draw_thumb_url:params.draw_thumb_url,  				//图纸
			contract_thumb_url:params.contract_thumb_url,		//合同
			material_thumb_url:params.material_thumb_url,		//选材单
			design_thumb_url:params.design_thumb_url,			//设计图纸
			is_back:params.is_back,
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/edit',data})
	},
	
	// 取消订单
	cancelOrder(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/cancel',data})
	},
	
	// 更换或新增施工负责人
	changePerson(params={}){
		let data  = {
			id:params.id,
			order_id:params.order_id,
			builder_id:params.builder_id,
			position:params.position,
			old_builder_id:params.old_builder_id
		}
		return utils.uniRequest({url:URL.BASE2 +'/builder/BuildDirector/replace',data})
	},
	
	// 删除订单
	delOrder(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/del',data})
	},
	
	// 获取施工播报列表
	getBroadList(params={}){
		let data = {
			order_id:params.order_id,
			page:params.page,
			pagesize:params.pagesize,
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildBroadcast/getList',data})
	},
	
	// 删除播报
	toDelBroad(params={}){
		let data={
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildBroadcast/del',data})
	},
	
	// 新增播报
	addBroad(params={}){
		let data = {
			order_id:params.order_id,
			title:params.title,
			media:params.media,
			type:params.type
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildBroadcast/add',data})
	},
	
	// 获取档案目录列表
	getCateLog(params={}){
		let data = {
			order_id:params.order_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/ArchiveCategory/getList',data})
	},
	
	// 新增档案留存
	toAdd(params={}){
		let data = {
			order_id:params.order_id,
			name:params.name
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/ArchiveCategory/add',data})
	},
	
	// 重命名
	resetName(params={}){
		let data = {
			id:params.id,
			name:params.name
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/ArchiveCategory/edit',data})
	},
	
	// 删除档案留存分类
	delCate(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/ArchiveCategory/del',data})
	},
	
	// 获取档案列表
	getArchList(params={}){
		let data = {
			category_id:params.category_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildArchive/getList',data})
	},
	
	// 获取档案详情
	getArchDetail(params={}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildArchive/getDetail',data})
	},
	
	// 新增档案
	addArch(params={}){
		let data ={
			order_id:params.order_id,
			category_id:params.category_id,
			title:params.title,
			content:params.content,
			media:params.media,
			type:params.type
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildArchive/add',data})
	},
	
	// 获取施工进度列表
	getProgressList(params={}){
		let data = {
			order_id:params.order_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildProgress/getList',data})
	},
	
	// 更改施工状态
	changeStatus(params={}){
		let data = {
			id:params.id,
			status:params.status
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildProgress/changeStatus',data})
	},
	
	// 一键完工
	oneBecome(params={}){
		let data = {
			order_id:params.order_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildProgress/onekeyFinish',data})
	},
	
	
	// 获取施工队首页消息（评论）
	getDemoListDesgin(params={}){
		let data = {
			team_id:params.team_id,
			page:params.page,
			pagesize:params.pagesize,
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildTeam/getCommentList',data})
	},
	// 删除施工队首页消息评论
	delDesginList(params={}){
		let data = {
			comment_id:params.comment_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuildTeam/delComment',data})
	},
	
	// 发起收款
	toCollection(params = {}){
		let data = {
			id:params.id
		}
		return utils.uniRequest({url:URL.BASE2 + '/builder/BuilderTeamOrder/initiateCollection',data})
	},
	//施工队订单
	getBuilderTeamOrderList(params = {}){
		let data = {
			status:params.status,
			keyword:params.keyword,
			page:params.page,
			pagesize:params.pagesize
		}
		return utils.uniRequest({url:URL.BASE2 + '/steward/Order/getBuilderTeamOrderList',data})
	},
	//账号转换申请
	changeApply(params = {}){
		let data = {
			market_id: params.market_id,
			user_id: params.user_id,
			name: params.name,
			mobile: params.mobile,
			settle_subject: params.settle_subject,
			id_no_front: params.id_no_front,
			id_no_back: params.id_no_back,
			settle_agreement: params.settle_agreement,
			partner_id: params.partner_id,
			partner_type: params.partner_type
		}
		return utils.uniRequest({url:URL.BASE2 + '/user/UserAccountChangeApply/apply',data})
	},
	//账号转换详情
	getDetailAccount(params = {}){
		let data = {
			user_id: params.user_id
		}
		return utils.uniRequest({url:URL.BASE2 + '/user/UserAccountChangeApply/getDetail',data})
	},
	//账号转换编辑
	changeApplyEdit(params = {}){
		let data = {
			apply_id: params.apply_id,
			market_id: params.market_id,
			user_id: params.user_id,
			name: params.name,
			mobile: params.mobile,
			settle_subject: params.settle_subject,
			id_no_front: params.id_no_front,
			id_no_back: params.id_no_back,
			settle_agreement: params.settle_agreement,
			partner_id: params.partner_id,
			partner_type: params.partner_type
		}
		return utils.uniRequest({url:URL.BASE2 + '/user/UserAccountChangeApply/edit',data})
	}
}